// import Cookies from 'js-cookie'

export const ACCESS_TOKEN = 'access_token';
export const REFRESH_TOKEN = 'refresh_token';
const RouterKey = 'router_id';
// export function getToken () {
//   return localStorage.getItem(TokenKey);
// }
export function getRefreshToken() {
  return localStorage.getItem(REFRESH_TOKEN);
}
export function getAccessToken() {
  return localStorage.getItem(ACCESS_TOKEN);
}

export function setToken(key, token) {
  return localStorage.setItem(key, token);
}

export function removeToken(key) {
  return localStorage.removeItem(key);
}

export function getRouterItem() {
  return JSON.parse(localStorage.getItem(RouterKey));
}

export function setRouterItem(value) {
  if (value instanceof Object) {
    value = JSON.stringify(value);
  }
  return localStorage.setItem(RouterKey, value);
}

export function removeRouterItem() {
  return localStorage.removeItem(RouterKey);
}
